package org.uoss.core.util;

import java.util.Collection;

public final class ValidationUtil {
	
	/**
	 * Check object is empty or not.
	 * @param value
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public static boolean isEmpty(Object obj){
		if(obj instanceof String){
			return obj==null||((String)obj).trim().length()==0;
		}
		else if(obj instanceof Collection){
			return obj==null||((Collection)obj).size()==0;
		}
		else if(obj instanceof Object[]){
			return obj==null||((Object[])obj).length==0;
		}
		else{
			return obj==null;
		}
	}
}
